import request from '@/utils/request'

// 查询汽车检测-维修工单列表
export function listWorkorder(query) {
  return request({
    url: '/repariorder/workorder/list',
    method: 'get',
    params: query
  })
}

// 查询汽车检测-维修工单详细
export function getWorkorder(id) {
  return request({
    url: '/repariorder/workorder/' + id,
    method: 'get'
  })
}

// 新增汽车检测-维修工单
export function addWorkorder(data) {
  return request({
    url: '/repariorder/workorder',
    method: 'post',
    data: data
  })
}

// 修改汽车检测-维修工单
export function updateWorkorder(data) {
  return request({
    url: '/repariorder/workorder',
    method: 'put',
    data: data
  })
}

// 删除汽车检测-维修工单
export function delWorkorder(id) {
  return request({
    url: '/repariorder/workorder/' + id,
    method: 'delete'
  })
}

// 车牌号查询车辆信息
export function queryCheckResult(plateNo) {
  return request({
    url: '/vehicle/order/vehicleinfo/' + plateNo,
    method: 'get'
  })
}

//查询维修项目
export function queryRepairProject() {
  return request({
    url: '/vehicle/order/project/list',
    method: 'get'
  })
}

export function totalPrice(param) {
  return request({
    url: "/repariorder/workorder/total/price",
    method: "post",
    data: param
  })
}

/**
 * 维修工单详情
 * @param id
 */
export function orderDet(id) {
  return request({
    url: "/repariorder/workorder/order/det/" + id,
    method: "get"
  })
}

export function endSubmitOrder(orderId){
  return request({
    url: "/repariorder/workorder/end/submit/order/"+ orderId,
    method: 'put'
  })
}

/**
 * 获取选中的维修项目
 * @param param
 */
export function getSelectedRepairItem(param) {
  return request({
    url: "/vehicle/order/selected/repair/item",
    method: "post",
    data: param
  })
}

/**
 * 维修项目小计
 * @param param
 */
export function calculateRepairItem(param) {
  return request({
    url: "/vehicle/order/calculate/repair/item",
    method: "post",
    data: param
  });
}

/**
 * 移除维修项目
 */
export function removeItem(param) {
  return request({
    url: "/repariorder/workorder/remove/item",
    method: "delete",
    data: param
  });
}

/**
 * 获取维修项目
 */
export function getRepairItemList() {
  return request({
    url: "/repariorder/workorder/get/repairItem",
    method: "get"
  })
}

/**
 * 获取所有配件
 */
export function allAccessories() {
  return request({
    url: "/vehicle/order/all/accessories",
    method: "get"
  })
}

/**
 * 获取选中的维修项目
 * @param param
 */
export function getSelectedAccessriesItem(param) {
  return request({
    url: "/vehicle/order/selected/accessries/item",
    method: "post",
    data: param
  })
}

/**
 * 保存配件编号
 */
export function saveAccessoriesNumber(param) {
  return request({
    url: "/vehicle/order/save/accessories/number",
    method: "post",
    data: param
  })
}

/**
 * 移除维修配件
 */
export function removeAccessories(param) {
  return request({
    url: "/repariorder/workorder/remove/accessories/" + param,
    method: "delete"
  })
}

/**
 * 取消工单
 */
export function cancelOrder(id) {
  return request({
    url: "/repariorder/workorder/cancel/" + id,
    method: "delete"
  })
}

/**
 * 上传健康数据
 */
export function submitHealthData(data) {
  return request({
    url: "/repariorder/workorder/submit/health",
    method: "post",
    data: data
  })
}

/**
 * 上传健康数据
 */
export function submitHealthDataNew(data) {
  return request({
    url: "/repariorder/workorder/submint/health/new",
    method: "post",
    data: data
  })
}
